<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <style type="text/css" media="screen">
        @import url("<c:url value="/resources/dojo/resources/dojo.css"/>");
        @import url("<c:url value="/resources/dijit/themes/tundra/tundra.css"/>");
        @import url("<c:url value="/static/styles/finance.css"/>");
    </style>

    <script djconfig="parseOnLoad: true" src="<c:url value="/resources/dojo/dojo.js"/>" type="text/javascript"></script>
    <script type="text/javascript" src="<c:url value="/resources/spring/Spring.js" />"></script>
    <script type="text/javascript" src="<c:url value="/resources/spring/Spring-Dojo.js" />"></script>
    <script type="text/javascript">dojo.require("dojo.parser");</script>
    <title>Spring Finance</title>

</head>

<body class="tundra spring">

<div id="wrap">

    <div id="menu">
        <%@ include file="/WEB-INF/jsp/menu.jsp" %>
    </div>
    <div id="main">
        <div id="body">


            <script type="text/javascript">dojo.require("dijit.TitlePane");</script>
            <div dojoType="dijit.TitlePane" style="width: 100%" title="Update Account">
                <form:form action="/account/${account.id}" method="PUT" modelAttribute="account">
                    <div>
                        <label for="name">Name:</label>
                        <form:input cssStyle="width:250px" maxlength="30" path="name" size="30"/>
                        <form:errors path="name" cssClass="errors"/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "name", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "Enter Name", required : true}})); </script>
                    </div>
                    <br/>

                    <div>
                        <c:if test="${not empty people}">
                            <label for="owners">Owners:</label>
                            <form:select cssStyle="width:250px" path="owners">
                                <form:options itemValue="id" items="${people}"/>
                            </form:select>
                            <form:errors path="owners" cssClass="errors"/>
                            <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "owners", widgetType: "dijit.form.MultiSelect")); </script>
                        </c:if>
                    </div>
                    <br/>

                    <div>
                        <c:if test="${not empty people}">
                            <label for="manager">Manager:</label>
                            <form:select cssStyle="width:250px" path="manager">
                                <form:options itemValue="id" items="${people}"/>
                            </form:select>
                            <form:errors path="manager" cssClass="errors"/>
                            <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "manager", widgetType: "dijit.form.FilteringSelect", widgetAttrs : {hasDownArrow : true}})); </script>
                        </c:if>
                    </div>
                    <br/>

                    <div>
                        <c:if test="${not empty investments}">
                            <label for="investments">Investments:</label>
                            <form:select cssStyle="width:250px" path="investments">
                                <form:options itemValue="id" items="${investments}"/>
                            </form:select>
                            <form:errors path="investments" cssClass="errors"/>
                            <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "investments", widgetType: "dijit.form.MultiSelect")); </script>
                        </c:if>
                    </div>
                    <br/>

                    <div class="submit">
                        <script type="text/javascript">Spring.addDecoration(new Spring.ValidateAllDecoration({elementId:'proceed', event:'onclick'}));</script>
                        <input id="proceed" type="submit" value="Update"/>
                    </div>
                    <form:hidden path="id"/>
                    <form:hidden path="version"/>
                </form:form>
            </div>
        </div>
        <table class="footer">
            <tr>
                <td><a href="<c:url value="/" />">Home</a></td>
                <td align="right"><a href="http://stsmedia.net" alt="StSMedia.net">StSMedia.net</a></td>
            </tr>
        </table>

    </div>
</div>
</body>

</html>